//
//  CollectionDetailHeaderViewModel.m
//  Tang
//
//  Created by 邓芮 on 15/12/7.
//  Copyright © 2015年 352324497@qq.com. All rights reserved.
//

#import "CollectionDetailHeaderViewModel.h"

@implementation CollectionDetailHeaderViewModel

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"id"])
    {
        [self setValue:value forKey:@"Id"];
    }
    else if ([key isEqualToString:@"description"])
    {
        [self setValue:value forKey:@"myDescription"];
    }
}

+ (CollectionDetailHeaderViewModel *)JsonWithDic:(NSDictionary *)dic
{
    NSDictionary *dataDic = dic[@"data"];
    NSDictionary *subjectDic = dataDic[@"subject"];
  
     CollectionDetailHeaderViewModel *model = [[CollectionDetailHeaderViewModel alloc]init];
    [model setValuesForKeysWithDictionary:subjectDic];
    model.authorDic = [NSMutableDictionary dictionary];
    UserModel *userModel = [[UserModel alloc]init];
    [userModel setValuesForKeysWithDictionary:subjectDic[@"author"]];
    [model.authorDic setObject:userModel forKey:@"dic"];
    return model;

}

@end
